<script type="text/javascript">
$(document).ready(function(){
	$("#role_kind").change(function(){
		var id = $(this).attr('value');
		$.getJSON("<?php echo $this->route('getitem')?>", { kind: id },
	 	function(data){
			$("#temp_id").empty();
  			$.each(data,function(i,v){
  				$("#temp_id").append('<option value="'+v.sn+'">'+v.name+'</option>');
  			  });
	  	});
		if (id != '')
		$("#temp_id").show();
		else {
			$("#temp_id").empty();
			$("#temp_id").hide();
		}
	});

});
</script>

<form  id="setForm" action="<?php echo $this->route("add") ?>" method="post" name="setForm" >
<input type="hidden" id="module_id" name="module_id"  value="<?php echo $this->moduleData['name']?>"/>
<input type="hidden" id="role_id" name="role_id" />
<table id="settable">
<caption><?php echo $this->translate('module installation')?></caption>
<tr>
<th><?php echo $this->translate('module name')?></th>
<td><span id="module_name"><?php echo $this->moduleData['name']?></span> </td>
</tr>

<tr>

<th><?php echo $this->translate('display name')?></th>
<td><input type="text" id="title" name="title" value="<?php echo $this->translate($this->moduleData['title'])?>" /> </td>
</tr>
<tr>
<th><?php echo $this->translate('belong to kind')?></th>
<td>
<select  id="parent_id"  name="parent_id"	>
  	<?php foreach ($this->moduleMenu as $row): ?>
  	<option value="<?php echo $row['resource_id'] ?>"><?php echo $this->escape($row['title']) ?></option>
  	<?php endforeach; ?>
 </select>
</td>
</tr>
<tr>
<th><?php echo $this->translate('enable after installation')?></th>
<td><input type="checkbox" id="published" name="published"  value="1" checked="checked"/> <?php echo $this->translate('immediate opening')?></td>
</tr>

<tr>
<th><?php echo $this->translate('authorization module')?></th>
<td>
	<select name="role_kind"
		id="role_kind">
	<option value=""> -- </option>
	<?php foreach ($this->roleKind as $id=>$val):?>
	<option value="<?php echo $id ?>"><?php echo $val ?></option>
	<?php endforeach ?>
	</select>
	<select name="temp_id"	id="temp_id" style="display:none" >
	</select>
	</td>
	</tr>
	<tr>
	<td colspan="2" align="center">
		<button > <?php echo $this->translate('installing')?> </button>
	</td>
</tr>
</table>
</form>
<table id="detailTable">
<caption><?php echo $this->translate('module infomation')?></caption>
<tr><th><?php echo $this->translate('description')?></th>
<td><?php echo $this->translate($this->moduleData['description'])?></td></tr>
<tr><th><?php echo $this->translate('version')?></th>
<td><?php echo $this->translate($this->moduleData['version'])?></td></tr>
<tr><th><?php echo $this->translate('authorization')?></th>
<td><?php echo $this->translate($this->moduleData['license'])?></td></tr>
<tr><th><?php echo $this->translate('author')?></th>
<td><?php echo $this->translate($this->moduleData['author'])?></td></tr>
<tr><th><?php echo $this->translate('Email')?></th>
<td><?php echo $this->translate($this->moduleData['authorEmail'])?></td></tr>
<tr><th><?php echo $this->translate('Website Url')?></th>
<td><?php echo $this->translate($this->moduleData['authorUrl'])?></td></tr>
<tr><th><?php echo $this->translate('created date')?></th>
<td><?php echo $this->translate($this->moduleData['creationDate'])?></td></tr>
</table>